a dose of (one's) own medicine

Translations
ответить тем же
He was always mocking others, but when they started mocking him back, he got a dose of his own medicine.
Он всегда издевался над другими, но когда они начали издеваться над ним в ответ, он получил ответ тем же.
Definitions
An experience in which someone is treated in the same negative or unpleasant way that they have treated others, often as a form of retribution or poetic justice.